<?php
require_once ("src/db/connectdatabase.php");

function getIntroLoan() {
	$con = new ConnectDB();
	$tbl = "loans";
	$fn = array('content_loan', 'condition_loan');
	$condetion = array('loan_id' => "vay_the_chap");
	return $con -> getvalue($tbl, $fn, $condetion);
}

function getRateBasicMorts() {
	$con = new ConnectDB();
	
	$sql = "Select r.bankid, b.bankname, r.basic_rate1, r.basic_rate2, r.datecreate, b.banklogo FROM rate_basic_mortgage as r, banks as b WHERE r.bankid = b.bankid AND r.basic_isuse=1 ORDER BY r.bankid";
	return $con -> getvalueString($sql);
}

$intro = getIntroLoan();
$ratedatebasic = getRateBasicMorts();
	?>
<div class="text12" style="margin: auto; width: 970px; height: 11px; margin-top: 11px; color: #0a8bd9;">
    <u><a href="<?php echo($host) ?>" class="text12" style="color: #0080d6;">Trang Chủ</a></u>&gt;<span class="text12" style="color: #4c4c4c;"> Vay thế chấp</span>
  <span style="float:right"><a href="<?php echo($host) ?>vay-the-chap/may-tinh-cho-vay-the-chap.html">
  <input type="button" value="Máy tính thế chấp" class="btn-class-maytinh" /></a></span>
</div>
<div style="clear: both; height: 5px;"></div>
<div class="intrl_txt" style="min-height:200px;">
	<?php 
	if(count($intro) == 1) {
	?>
	<div class="text11" style="color: #4c4c4c; width: 100%; margin-left: 8px;"><?php echo($intro[0][1]) ?></div>
	<?php
	}
	?>
	<div style="clear: both; height: 5px;"></div>
    <div class="intrl_txt" style="float: left; width: 660px; margin-top: 10px; clear: right;">
        <?php 
        if(count($intro) == 1) {
        ?>
        <div class="text11" style="color: #4c4c4c; width: 650px; margin-left: 8px; margin-top: 10px;"><?php echo($intro[0][0]) ?></div>
        <?php
        }
        ?>
    </div>
    <div style="float: right; clear: right; width: 275px; height: auto; margin-top: 10px;">
    	<div style="float:right; clear:right; background: #F4F4F4; width:275px; height:auto; margin-top:18px; min-height: 20px; border-radius: 2px; border: 2px solid #DDE4E9">
        	<div style="width:270px; margin:auto; height:auto; margin-top:3px; background-color:#f4f4f4;">
            	<div style="clear:both; height:5px;"></div>
                <div class="text3" style="width:270px; text-align: center; margin:auto; height:auto; color:#88a943; margin-top:2px; font-size: 14px"><strong>Lãi Suất Cho Vay Thế Chấp</strong></div>
                <div class="text11" style="width:270px; margin:auto; height:auto;  color:#4c4c4c; margin-top:1px; text-align:center;">( Cập nhật cuối cùng:  <?php echo date("d/m/Y",time()); ?> )</div>
                <div style="clear:both; height:5px;"></div>
                <table width="265" cellspacing="1" cellpadding="0" border="0" bgcolor="#e0eaf1" align="center">
                	<tr bgcolor="#FFFFFF">
                    	<td class="tbl_txt" width="100" valign="middle" align="center" height="22">Ngân hàng</td>
                        <td class="tbl_txt" width="95" valign="middle" align="center" style="width:95px; ">Lãi suất</td>
                        <td class="tbl_txt" width="70" valign="middle" align="center">Chọn</td>
                    </tr>
                    <?php
					foreach($ratedatebasic as $entry) {
					?>
                    <tr bgcolor="#FFFFFF">
                    	<td valign="middle" align="center" height="35" style="font-size:10px;"><a target="_blank" class="tbl_txt" style="color:#335599;line-height:13px; text-decoration:none;" href="<?php echo($host) ?>vay-the-chap/ap-dung-cho-vay-the-chap/bank/<?php echo($entry[0]) ?>.html"><img width="90px" style="margin:5px;" src="<?php echo($host) ?><?php echo($entry[5]) ?>" alt="<?php echo($entry[1]) ?>" title="<?php echo($entry[1]) ?>" /></a></td>
                        <td class="tbl_txt" valign="middle" align="center"><?php echo($entry[2]) ?>% - <?php echo($entry[3]) ?>%</td>
                        <td class="tbl_txt" valign="middle" align="center" style="font-size:10px;"><a target="_blank" href="<?php echo($host) ?>vay-the-chap/ap-dung-cho-vay-the-chap/bank/<?php echo($entry[0]) ?>.html"><img width="45" border="0" height="20" src="<?php echo($host) ?>images/get1.gif"></img></a></td>
                    </tr>
                    <?php
					}
					?>
                </table>
                <div style="clear:both; height:3px;"></div>
            </div>
        </div>
    </div>
</div>
